//
//  TBRRentDetailOnOffCarCell.m
//  TBRentClient
//
//  Created by tonbright on 2018/5/14.
//  Copyright © 2018年 tonbright. All rights reserved.
//

#import "TBRRentDetailOnOffCarCell.h"
#import "TBRGetPlaneMessageModel.h"
@interface TBRRentDetailOnOffCarCell()
@property (weak, nonatomic) IBOutlet UIView *view_green;
@property (weak, nonatomic) IBOutlet UIView *view_red;
@property (weak, nonatomic) IBOutlet UIView *view_newGreen;

@end
@implementation TBRRentDetailOnOffCarCell

- (void)awakeFromNib {
    [super awakeFromNib];
    _view_red.layer.cornerRadius = 6.5;
    _view_green.layer.cornerRadius = 6.5;
    _view_newGreen.layer.cornerRadius = 6.5;
}


- (IBAction)selPlaneMessageBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(TBRRentDetailOnOffCarCellSelPlaneBtnClick)]) {
        [self.delegate TBRRentDetailOnOffCarCellSelPlaneBtnClick];
    }
}

- (IBAction)onCarPlaceBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(TBRRentDetailOnOffCarCellOnCarBtnClick)]) {
        [self.delegate TBRRentDetailOnOffCarCellOnCarBtnClick];
    }
}

- (IBAction)offCarBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(TBRRentDetailOnOffCarCellOnCarBtnClick)]) {
        [self.delegate TBRRentDetailOnOffCarCellOffCarBtnClick];
    }
}

- (void)refreshUI {
    if (self.selIndex == 2) {
        TBRGetPlaneMessageModel *planeMessageModel = [TBRRentAllMessageModel shareAllMessageModel].selPlaneMessageModel;
        _view_plane.hidden = NO;
        _lbe_planeNum.text = planeMessageModel.flightNo;
        _lbe_planeDetail.text = planeMessageModel.showPlaneStr;
    }
    _lbe_onCarPlace.text = [HelpObject isBlankString:[TBRRentAllMessageModel shareAllMessageModel].onPlace] ? @"正在获取上车地点..." : [TBRRentAllMessageModel shareAllMessageModel].onPlace;
    
    _lbe_offCarPlace.text = [HelpObject isBlankString:[TBRRentAllMessageModel shareAllMessageModel].offPlace] ? @"请选择您的还车地点" : [TBRRentAllMessageModel shareAllMessageModel].offPlace;
    if (self.selIndex == 3) {
        _lbe_offCarPlace.text = [TBRRentAllMessageModel shareAllMessageModel].toAirPort;
    }
    if (self.selIndex == 4) {
        _lbe_onCarPlace.text = [TBRRentAllMessageModel shareAllMessageModel].charterTimeDuration;
        _lbe_offCarPlace.text = [TBRRentAllMessageModel shareAllMessageModel].onPlace;
    }
}
@end
